package musics.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

import base2dev.core.model.imp.EntityBase;

@Entity
public class Album extends EntityBase<Album> {

	private static final long serialVersionUID = -4847409106777056030L;
	private String name;
	private String image;
	private String history;
	@Transient
	private Date date;
	@Transient
	private int order;
	private long playCount;
	private long points;
	@OneToMany(cascade = CascadeType.ALL)
	private List<Song> songs;
	private Artist artist;
	private String downloadUrl;

	
	
	

	public Album addSong(Song song){		
		getSongs().add(song);
		return this; 
	}
	
	
	public String getName() {
		return name;
	}

	public Album setName(String name) {
		this.name = name;
		return this;
	}

	public String getImage() {
		return image;
	}

	public Album setImage(String image) {
		this.image = image;
		return this;
	}

	public Date getDate() {
		return date;
	}

	public Album setDate(Date date) {
		this.date = date;
		return this;
	}

	public int getOrder() {
		return order;
	}

	public Album setOrder(int order) {
		this.order = order;
		return this;
	}

	public long getPlayCount() {
		return playCount;
	}

	public Album setPlayCount(long playCount) {
		this.playCount = playCount;
		return this;
	}

	public long getPoints() {
		return points;
	}

	public Album setPoints(long points) {
		this.points = points;
		return this;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public String getHistory() {
		return history;
	}

	public Album setHistory(String history) {
		this.history = history;
		return this;
	}

	public Album setSongs(List<Song> songs) {
		this.songs = songs;
		return this;
	}

	public List<Song> getSongs() {
		
		if ( songs == null)
			songs = new ArrayList<Song>(20);
		
		return songs;
	}

	public Album setArtist(Artist artist) {
		this.artist = artist;
		return this;
	}

	public Artist getArtist() {
		return artist;
	}
	
	public String getDownloadUrl() {
		return downloadUrl;
	}

	public Album setDownloadUrl(String downloadUrl) {
		
		this.downloadUrl = downloadUrl;
		return this; 
	}

}
